<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">

                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h1><h:outputText value="List Vacancy"/></h1>
                <h:outputLabel value="#{vmb.message}"/>
                <p:dataTable id="dataTable" value="#{vmb.vacancyList()}" var="vac" paginator="true" rows="5"  
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                             rowsPerPageTemplate="3,5,10,15">

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Title"/>
                        </f:facet>
                        <h:outputText value="#{vac.title}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="CreatedDate"/>
                        </f:facet>
                        <h:outputText value="#{vac.createdDate}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{vac.status}"/>
                    </p:column>                            
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Position"/>
                        </f:facet>
                        <h:outputText value="#{vac.position}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="WorkingPlace"/>
                        </f:facet>
                        <h:outputText value="#{vac.workingPlace}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="WorkType"/>
                        </f:facet>
                        <h:outputText value="#{vac.workType}"/>
                    </p:column>                                                                                                               
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Degree"/>
                        </f:facet>
                        <h:outputText value="#{vac.degree}"/>
                    </p:column>                            
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="ProbationaryPeriod"/>
                        </f:facet>
                        <h:outputText value="#{vac.probationaryPeriod}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Deadline"/>
                        </f:facet>
                        <h:outputText value="#{vac.deadline}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="DepartmentID"/>
                        </f:facet>
                        <h:outputText value="#{vac.departmentID.name}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Action"/>
                        </f:facet>
                        <h:commandLink value="View" action="#{vmb.vacView(vac)}" title="View"/><br/>
                        <h:commandLink value="Edit" action="#{vmb.vacEdit(vac)}" title="Edit"/><br/>
                        <h:commandLink value="Delete" action="#{vmb.deletevacancy(vac)}" title="Delete" onclick="return confirm('Are you sure delete not?')"/><br/>
                    </p:column>
                </p:dataTable>  
                <p:commandButton action="Create" value="New Create" title="Add"/>                      
            </h:form>
        </ui:define>
    </ui:composition>

</html>
